package com.luo.demo.validation.domain.param;

import com.luo.demo.validation.constraints.EnumRange;
import com.luo.demo.validation.enums.ApiTypeEnum;
import com.luo.demo.validation.enums.ResourceTypeEnum;
import com.luo.demo.validation.enums.RoleTypeEnum;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 枚举验证 - 参数
 *
 * @author luohq
 * @date 2023-06-17 07:20
 */
public class EnumParam {

    /**
     * 接口类型，允许值: {"0", "1"}
     */
    @NotBlank
    @EnumRange(enumType = ApiTypeEnum.class, enumValueMethod = "getCode")
    private String apiType;

    /**
     * 资源类型，允许值：{0, 1, 2}
     */
    @NotNull
    @EnumRange(enumType = ResourceTypeEnum.class, enumValueMethod = "getCode")
    private Integer resourceType;

    /**
     * 角色类型，允许值：{"PLATFORM_ROLE", "TENANT_ROLE"}
     */
    @NotBlank
    @EnumRange(enumType = RoleTypeEnum.class)
    private String roleType;


    public String getApiType() {
        return apiType;
    }

    public void setApiType(String apiType) {
        this.apiType = apiType;
    }

    public Integer getResourceType() {
        return resourceType;
    }

    public void setResourceType(Integer resourceType) {
        this.resourceType = resourceType;
    }

    public String getRoleType() {
        return roleType;
    }

    public void setRoleType(String roleType) {
        this.roleType = roleType;
    }

    @Override
    public String toString() {
        return "EnumParam{" +
                "apiType='" + apiType + '\'' +
                ", resourceType=" + resourceType +
                ", roleType='" + roleType + '\'' +
                '}';
    }
}
